<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>社交活动平台 - 搜索</title>
    <style>
        /* 重置样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }

        /* 容器样式 */
        .container {
            max-width: 480px;
            margin: 0 auto;
            background-color: #fff;
            min-height: 100vh;
        }

        /* 头部导航 */
        .header {
            position: sticky;
            top: 0;
            background-color: white;
            padding: 16px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            z-index: 100;
        }

        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .back-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #333;
        }

        .header-title {
            font-size: 18px;
            font-weight: bold;
            flex-grow: 1;
            text-align: center;
        }

        /* 搜索区域 */
        .search-section {
            padding: 16px;
            background-color: #f9f9f9;
        }

        .search-container {
            display: flex;
            align-items: center;
            background-color: white;
            border-radius: 24px;
            padding: 8px 16px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .search-icon {
            font-size: 18px;
            color: #999;
            margin-right: 8px;
        }

        .search-input {
            flex-grow: 1;
            border: none;
            outline: none;
            font-size: 16px;
            padding: 8px 0;
        }

        .search-btn {
            background: linear-gradient(135deg, #45b7d1 0%, #2c8cb9 100%);
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 14px;
            cursor: pointer;
        }

        /* 筛选面板 */
        .filter-section {
            padding: 16px;
            border-bottom: 1px solid #eee;
        }

        .filter-title {
            font-size: 16px;
            font-weight: bold;
            margin-bottom: 12px;
            color: #333;
        }

        .filter-options {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }

        .filter-option {
            padding: 8px 16px;
            border-radius: 20px;
            background-color: #f0f8ff;
            color: #45b7d1;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .filter-option:hover {
            background-color: #e1f0ff;
        }

        .filter-option.active {
            background-color: #45b7d1;
            color: white;
        }

        /* 热门标签 */
        .hot-tags-section {
            padding: 16px;
            border-bottom: 1px solid #eee;
        }

        .tags-title {
            font-size: 16px;
            font-weight: bold;
            margin-bottom: 12px;
            color: #333;
        }

        .hot-tags {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .hot-tag {
            padding: 8px 16px;
            border-radius: 20px;
            background-color: #f5f5f5;
            color: #666;
            font-size: 14px;
            cursor: pointer;
        }

        .hot-tag:hover {
            background-color: #e0e0e0;
        }

        /* 搜索结果 */
        .results-section {
            padding: 16px;
        }

        .results-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .results-title {
            font-size: 18px;
            font-weight: bold;
        }

        .results-count {
            color: #999;
            font-size: 14px;
        }

        /* 活动卡片 */
        .activity-card {
            background: white;
            border-radius: 16px;
            overflow: hidden;
            margin-bottom: 20px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
        }

        .activity-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(0, 0, 20, 0.1);
        }

        /* 卡片封面 */
        .activity-cover {
            width: 100%;
            height: 160px;
            object-fit: cover;
        }

        /* 卡片内容 */
        .activity-content {
            padding: 16px;
        }

        .activity-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 8px;
            color: #333;
        }

        .activity-meta {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
            font-size: 14px;
            color: #666;
        }

        .meta-item {
            display: flex;
            align-items: center;
        }

        .meta-icon {
            margin-right: 4px;
            font-size: 16px;
        }

        /* 活动标签 */
        .activity-tags {
            display: flex;
            gap: 8px;
            margin-bottom: 12px;
        }

        .tag {
            background-color: #f0f8ff;
            color: #45b7d1;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 12px;
        }

        /* 社交温度标签 */
        .activity-temperature {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: bold;
            margin-bottom: 12px;
        }

        .temperature-hot {
            background-color: #ffebee;
            color: #e53935;
        }

        .temperature-warm {
            background-color: #fff8e1;
            color: #ff8f00;
        }

        .temperature-calm {
            background-color: #e8f5e9;
            color: #388e3c;
        }

        /* 参与统计 */
        .activity-stats {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .participants {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .avatar-group {
            display: flex;
            align-items: center;
        }

        .avatar-item {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background-color: #e0e0e0;
            border: 2px solid white;
            margin-left: -8px;
        }

        .avatar-item:first-child {
            margin-left: 0;
        }

        .participant-count {
            font-size: 14px;
            color: #666;
        }

        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: white;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: space-around;
            padding: 12px 0;
            z-index: 100;
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #9e9e9e;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .nav-item.active {
            color: #ff6b35;
        }

        .nav-icon {
            font-size: 20px;
            margin-bottom: 4px;
        }

        /* 加载动画 */
        .loading {
            text-align: center;
            padding: 40px 20px;
        }

        .spinner {
            width: 36px;
            height: 36px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid #ff6b35;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background-color: white;
            border-radius: 16px;
            width: 85%;
            max-width: 320px;
            padding: 24px;
            text-align: center;
            transform: translateY(20px);
            opacity: 0;
            transition: all 0.3s ease;
        }

        .modal.show {
            transform: translateY(0);
            opacity: 1;
        }

        .modal-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 16px;
            color: #333;
        }

        .modal-message {
            margin-bottom: 24px;
            color: #666;
            line-height: 1.6;
        }

        .modal-actions {
            display: flex;
            gap: 12px;
        }

        .modal-btn {
            flex: 1;
            padding: 12px;
            border-radius: 8px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .cancel-btn {
            background-color: #f5f5f5;
            color: #666;
        }

        .confirm-btn {
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
        }

        /* 响应式适配 */
        @media (max-width: 480px) {
            .activity-cover {
                height: 140px;
            }
            
            .header-content {
                padding-top: 4px;
            }
        }

        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .activity-card {
            animation: fadeInUp 0.6s ease forwards;
        }

        /* 活动卡片动画延迟 */
        .activity-card:nth-child(1) { animation-delay: 0.1s; }
        .activity-card:nth-child(2) { animation-delay: 0.2s; }
        .activity-card:nth-child(3) { animation-delay: 0.3s; }
        .activity-card:nth-child(4) { animation-delay: 0.4s; }
        .activity-card:nth-child(5) { animation-delay: 0.5s; }

        /* 活动类型标签颜色 */
        .tag-sport { background-color: #e3f2fd; color: #1976d2; }
        .tag-learning { background-color: #f3e5f5; color: #7b1fa2; }
        .tag-social { background-color: #e8f5e9; color: #388e3c; }
        .tag-food { background-color: #fff3e0; color: #f57c00; }
        .tag-culture { background-color: #fce4ec; color: #c2185b; }
        .tag-outdoor { background-color: #e0f2f1; color: #00796b; }
    </style>
</head>
<body>
    <div class="container">
        <!-- 头部导航 -->
        <header class="header">
            <div class="header-content">
                <button class="back-btn" id="backBtn">←</button>
                <div class="header-title">搜索活动</div>
                <button class="action-btn" id="filterBtn">筛选</button>
            </div>
        </header>

        <!-- 搜索区域 -->
        <div class="search-section">
            <div class="search-container">
                <span class="search-icon">🔍</span>
                <input type="text" class="search-input" id="searchInput" placeholder="搜索活动、标签或地点...">
                <button class="search-btn" id="searchSubmitBtn">搜索</button>
            </div>
        </div>

        <!-- 筛选面板 -->
        <div class="filter-section">
            <h3 class="filter-title">筛选条件</h3>
            <div class="filter-options">
                <div class="filter-option active" data-filter="all">全部</div>
                <div class="filter-option" data-filter="today">今天</div>
                <div class="filter-option" data-filter="week">本周</div>
                <div class="filter-option" data-filter="month">本月</div>
            </div>
        </div>

        <!-- 热门标签 -->
        <div class="hot-tags-section">
            <h3 class="tags-title">热门标签</h3>
            <div class="hot-tags">
                <div class="hot-tag" data-tag="运动">运动</div>
                <div class="hot-tag" data-tag="学习">学习</div>
                <div class="hot-tag" data-tag="社交">社交</div>
                <div class="hot-tag" data-tag="美食">美食</div>
                <div class="hot-tag" data-tag="户外">户外</div>
                <div class="hot-tag" data-tag="文化">文化</div>
                <div class="hot-tag" data-tag="音乐">音乐</div>
                <div class="hot-tag" data-tag="电影">电影</div>
            </div>
        </div>

        <!-- 搜索结果 -->
        <div class="results-section">
            <div class="results-header">
                <h3 class="results-title">搜索结果</h3>
                <div class="results-count" id="resultsCount">找到 12 个活动</div>
            </div>

            <!-- 活动卡片列表 -->
            <div class="activity-list" id="activityList">
                <!-- 活动卡片 1 -->
                <div class="activity-card" data-activity-id="1">
                    <img src="https://images.unsplash.com/photo-1501854140801-50d01698950b?w=400&h=160&fit=crop" alt="户外徒步活动" class="activity-cover">
                    <div class="activity-content">
                        <h3 class="activity-title">周末户外徒步活动</h3>
                        <div class="activity-meta">
                            <div class="meta-item">
                                <span class="meta-icon">📍</span>
                                <span>城市公园</span>
                            </div>
                            <div class="meta-item">
                                <span class="meta-icon">⏰</span>
                                <span>周六 14:00</span>
                            </div>
                        </div>
                        
                        <div class="activity-temperature temperature-hot">🔥 热门活跃</div>
                        
                        <div class="activity-tags">
                            <span class="tag tag-sport">运动</span>
                            <span class="tag tag-outdoor">户外</span>
                        </div>
                        
                        <div class="activity-stats">
                            <div class="participants">
                                <div class="avatar-group">
                                    <div class="avatar-item" style="background-color: #42b983;"></div>
                                    <div class="avatar-item" style="background-color: #ff6b35;"></div>
                                    <div class="avatar-item" style="background-color: #45b7d1;"></div>
                                    <div class="avatar-item" style="background-color: #9c27b0;"></div>
                                </div>
                                <span class="participant-count">12人参与</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 活动卡片 2 -->
                <div class="activity-card" data-activity-id="2">
                    <img src="https://images.unsplash.com/photo-1504805572947-34fad45aed93?w=400&h=160&fit=crop" alt="读书分享会" class="activity-cover">
                    <div class="activity-content">
                        <h3 class="activity-title">经典小说读书分享会</h3>
                        <div class="activity-meta">
                            <div class="meta-item">
                                <span class="meta-icon">📍</span>
                                <span>咖啡书店</span>
                            </div>
                            <div class="meta-item">
                                <span class="meta-icon">⏰</span>
                                <span>周五 19:30</span>
                            </div>
                        </div>
                        
                        <div class="activity-temperature temperature-warm">🌟 温暖友好</div>
                        
                        <div class="activity-tags">
                            <span class="tag tag-learning">学习</span>
                            <span class="tag tag-social">社交</span>
                        </div>
                        
                        <div class="activity-stats">
                            <div class="participants">
                                <div class="avatar-group">
                                    <div class="avatar-item" style="background-color: #ff9800;"></div>
                                    <div class="avatar-item" style="background-color: #795548;"></div>
                                    <div class="avatar-item" style="background-color: #607d8b;"></div>
                                </div>
                                <span class="participant-count">8人参与</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 活动卡片 3 -->
                <div class="activity-card" data-activity-id="3">
                    <img src="https://images.unsplash.com/photo-1543269865-cbf427effbad?w=400&h=160&fit=crop" alt="摄影交流会" class="activity-cover">
                    <div class="activity-content">
                        <h3 class="activity-title">周末摄影交流会</h3>
                        <div class="activity-meta">
                            <div class="meta-item">
                                <span class="meta-icon">📍</span>
                                <span>城市广场</span>
                            </div>
                            <div class="meta-item">
                                <span class="meta-icon">⏰</span>
                                <span>周日 10:00</span>
                            </div>
                        </div>
                        
                        <div class="activity-temperature temperature-calm">💫 精致优雅</div>
                        
                        <div class="activity-tags">
                            <span class="tag tag-culture">文化</span>
                            <span class="tag tag-social">社交</span>
                        </div>
                        
                        <div class="activity-stats">
                            <div class="participants">
                                <div class="avatar-group">
                                    <div class="avatar-item" style="background-color: #3f51b5;"></div>
                                    <div class="avatar-item" style="background-color: #e91e63;"></div>
                                    <div class="avatar-item" style="background-color: #009688;"></div>
                                    <div class="avatar-item" style="background-color: #ff5722;"></div>
                                    <div class="avatar-item" style="background-color: #9e9e9e;"></div>
                                </div>
                                <span class="participant-count">25人参与</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 活动卡片 4 -->
                <div class="activity-card" data-activity-id="4">
                    <img src="https://images.unsplash.com/photo-1503376780353-7e6692767b70?w=400&h=160&fit=crop" alt="美食探店" class="activity-cover">
                    <div class="activity-content">
                        <h3 class="activity-title">城市美食探店之旅</h3>
                        <div class="activity-meta">
                            <div class="meta-item">
                                <span class="meta-icon">📍</span>
                                <span>美食街</span>
                            </div>
                            <div class="meta-item">
                                <span class="meta-icon">⏰</span>
                                <span>周六 18:00</span>
                            </div>
                        </div>
                        
                        <div class="activity-temperature temperature-hot">🔥 热门活跃</div>
                        
                        <div class="activity-tags">
                            <span class="tag tag-food">美食</span>
                            <span class="tag tag-social">社交</span>
                        </div>
                        
                        <div class="activity-stats">
                            <div class="participants">
                                <div class="avatar-group">
                                    <div class="avatar-item" style="background-color: #2196f3;"></div>
                                    <div class="avatar-item" style="background-color: #8bc34a;"></div>
                                    <div class="avatar-item" style="background-color: #ffeb3b;"></div>
                                </div>
                                <span class="participant-count">15人参与</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 活动卡片 5 -->
                <div class="activity-card" data-activity-id="5">
                    <img src="https://images.unsplash.com/photo-1493246507139-91e8fad9978e?w=400&h=160&fit=crop" alt="手工制作" class="activity-cover">
                    <div class="activity-content">
                        <h3 class="activity-title">手工制作DIY工作坊</h3>
                        <div class="activity-meta">
                            <div class="meta-item">
                                <span class="meta-icon">📍</span>
                                <span>创意工坊</span>
                            </div>
                            <div class="meta-item">
                                <span class="meta-icon">⏰</span>
                                <span>周日 14:00</span>
                            </div>
                        </div>
                        
                        <div class="activity-temperature temperature-warm">🌟 温暖友好</div>
                        
                        <div class="activity-tags">
                            <span class="tag tag-culture">文化</span>
                            <span class="tag tag-social">社交</span>
                        </div>
                        
                        <div class="activity-stats">
                            <div class="participants">
                                <div class="avatar-group">
                                    <div class="avatar-item" style="background-color: #ff5722;"></div>
                                    <div class="avatar-item" style="background-color: #9c27b0;"></div>
                                </div>
                                <span class="participant-count">6人参与</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 活动卡片 6 -->
                <div class="activity-card" data-activity-id="6">
                    <img src="https://images.unsplash.com/photo-1523906754882-3d2a3f15b1e2?w=400&h=160&fit=crop" alt="音乐分享会" class="activity-cover">
                    <div class="activity-content">
                        <h3 class="activity-title">周末音乐分享会</h3>
                        <div class="activity-meta">
                            <div class="meta-item">
                                <span class="meta-icon">📍</span>
                                <span>音乐厅</span>
                            </div>
                            <div class="meta-item">
                                <span class="meta-icon">⏰</span>
                                <span>周六 20:00</span>
                            </div>
                        </div>
                        
                        <div class="activity-temperature temperature-calm">💫 精致优雅</div>
                        
                        <div class="activity-tags">
                            <span class="tag tag-culture">文化</span>
                            <span class="tag tag-social">社交</span>
                        </div>
                        
                        <div class="activity-stats">
                            <div class="participants">
                                <div class="avatar-group">
                                    <div class="avatar-item" style="background-color: #9c27b0;"></div>
                                    <div class="avatar-item" style="background-color: #673ab7;"></div>
                                    <div class="avatar-item" style="background-color: #2196f3;"></div>
                                </div>
                                <span class="participant-count">20人参与</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 加载更多按钮 -->
            <div class="load-more-section" style="text-align: center; padding: 20px;">
                <button class="search-btn" id="loadMoreBtn">加载更多</button>
            </div>
        </div>

        <!-- 底部导航 -->
        <nav class="bottom-nav">
            <div class="nav-item" data-page="home">
                <span class="nav-icon">🏠</span>
                <span>首页</span>
            </div>
            <div class="nav-item active" data-page="search">
                <span class="nav-icon">🔍</span>
                <span>搜索</span>
            </div>
            <div class="nav-item" data-page="publish">
                <span class="nav-icon">➕</span>
                <span>发布</span>
            </div>
            <div class="nav-item" data-page="profile">
                <span class="nav-icon">👤</span>
                <span>我的</span>
            </div>
        </nav>

        <!-- 加载状态 -->
        <div class="loading" id="loadingIndicator">
            <div class="spinner"></div>
            <p>搜索中...</p>
        </div>

        <!-- 通知 Toast -->
        <div id="toast" style="display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #4caf50; color: white; padding: 12px 24px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1001;"></div>
    </div>

    <script>
        // 全局变量
        let currentFilter = 'all';
        let searchHistory = JSON.parse(localStorage.getItem('searchHistory')) || [];
        let currentPage = 1;
        const activitiesPerPage = 5;

        // 初始化
        document.addEventListener('DOMContentLoaded', function() {
            initEventListeners();
            simulateLoading();
            
            // 显示搜索历史
            showSearchHistory();
        });

        // 初始化事件监听器
        function initEventListeners() {
            // 返回按钮
            document.getElementById('backBtn').addEventListener('click', function() {
                window.history.back();
            });

            // 搜索输入
            const searchInput = document.getElementById('searchInput');
            
            // 回车搜索
            searchInput.addEventListener('keypress', function(e) {
                if (e.key === 'Enter') {
                    performSearch();
                }
            });

            // 搜索按钮
            document.getElementById('searchSubmitBtn').addEventListener('click', performSearch);

            // 筛选选项
            const filterOptions = document.querySelectorAll('.filter-option');
            filterOptions.forEach(option => {
                option.addEventListener('click', function() {
                    // 移除所有激活状态
                    filterOptions.forEach(opt => opt.classList.remove('active'));
                    // 添加当前激活状态
                    this.classList.add('active');
                    
                    currentFilter = this.dataset.filter;
                    
                    // 模拟筛选效果
                    showLoading();
                    setTimeout(() => {
                        hideLoading();
                        updateResultsCount();
                    }, 800);
                });
            });

            // 热门标签点击
            const hotTags = document.querySelectorAll('.hot-tag');
            hotTags.forEach(tag => {
                tag.addEventListener('click', function() {
                    const tagName = this.dataset.tag;
                    searchInput.value = tagName;
                    performSearch();
                });
            });

            // 底部导航切换
            const navItems = document.querySelectorAll('.nav-item');
            navItems.forEach(item => {
                item.addEventListener('click', function() {
                    // 移除所有激活状态
                    navItems.forEach(i => i.classList.remove('active'));
                    // 添加当前激活状态
                    this.classList.add('active');
                    
                    const page = this.dataset.page;
                    handleNavigation(page);
                });
            });

            // 加载更多按钮
            document.getElementById('loadMoreBtn').addEventListener('click', function() {
                loadMoreActivities();
            });

            // 活动卡片点击
            const activityCards = document.querySelectorAll('.activity-card');
            activityCards.forEach(card => {
                card.addEventListener('click', function() {
                    const activityId = this.dataset.activityId;
                    alert(`查看活动详情：${activityId}`);
                });
            });

            // 搜索历史点击
            document.addEventListener('click', function(e) {
                if (e.target.classList.contains('search-history-item')) {
                    const keyword = e.target.dataset.keyword;
                    searchInput.value = keyword;
                    performSearch();
                }
            });
        }

        // 执行搜索
        function performSearch() {
            const keyword = document.getElementById('searchInput').value.trim();
            
            if (!keyword) {
                alert('请输入搜索关键词');
                return;
            }
            
            // 添加到搜索历史
            addToSearchHistory(keyword);
            
            // 显示加载状态
            showLoading();
            
            // 模拟搜索过程
            setTimeout(() => {
                hideLoading();
                
                // 更新结果数量
                updateResultsCount();
                
                // 显示成功提示
                showSuccessToast(`搜索 "${keyword}" 成功`);
            }, 1500);
        }

        // 添加到搜索历史
        function addToSearchHistory(keyword) {
            if (!keyword.trim()) return;
            
            // 移除重复项
            searchHistory = searchHistory.filter(item => item !== keyword);
            
            // 添加到开头
            searchHistory.unshift(keyword);
            
            // 限制历史记录数量
            if (searchHistory.length > 10) {
                searchHistory = searchHistory.slice(0, 10);
            }
            
            // 保存到本地存储
            localStorage.setItem('searchHistory', JSON.stringify(searchHistory));
            
            // 更新显示
            showSearchHistory();
        }

        // 显示搜索历史
        function showSearchHistory() {
            // 可以在这里添加搜索历史显示逻辑
        }

        // 更新结果数量
        function updateResultsCount() {
            const countElement = document.getElementById('resultsCount');
            const currentCount = Math.floor(Math.random() * 20) + 5; // 模拟随机结果数量
            countElement.textContent = `找到 ${currentCount} 个活动`;
        }

        // 加载更多活动
        function loadMoreActivities() {
            showLoading();
            
            setTimeout(() => {
                hideLoading();
                
                // 模拟添加更多活动
                const activityList = document.getElementById('activityList');
                const moreActivities = generateMoreActivities();
                
                moreActivities.forEach(activity => {
                    activityList.appendChild(activity);
                });
                
                // 更新结果数量
                updateResultsCount();
                
                showSuccessToast('已加载更多活动');
            }, 1000);
        }

        // 生成更多活动卡片
        function generateMoreActivities() {
            const activities = [];
            const types = ['运动', '学习', '社交', '美食', '文化'];
            const locations = ['咖啡书店', '城市公园', '创意工坊', '美食街', '音乐厅'];
            
            for (let i = 0; i < 3; i++) {
                const activityCard = document.createElement('div');
                activityCard.className = 'activity-card';
                activityCard.dataset.activityId = 7 + i;
                
                const typeIndex = Math.floor(Math.random() * types.length);
                const locationIndex = Math.floor(Math.random() * locations.length);
                
                activityCard.innerHTML = `
                    <img src="https://picsum.photos/400/160?random=${Date.now() + i}" alt="${types[typeIndex]}活动" class="activity-cover">
                    <div class="activity-content">
                        <h3 class="activity-title">${types[typeIndex]}活动 ${7 + i}</h3>
                        <div class="activity-meta">
                            <div class="meta-item">
                                <span class="meta-icon">📍</span>
                                <span>${locations[locationIndex]}</span>
                            </div>
                            <div class="meta-item">
                                <span class="meta-icon">⏰</span>
                                <span>${getRandomTime()}</span>
                            </div>
                        </div>
                        
                        <div class="activity-temperature temperature-${getRandomTemperature()}">🔥 热门活跃</div>
                        
                        <div class="activity-tags">
                            <span class="tag tag-${getRandomTag()}">${types[typeIndex]}</span>
                        </div>
                        
                        <div class="activity-stats">
                            <div class="participants">
                                <div class="avatar-group">
                                    <div class="avatar-item" style="background-color: #${Math.floor(Math.random()*16777215).toString(16)};"></div>
                                    <div class="avatar-item" style="background-color: #${Math.floor(Math.random()*16777215).toString(16)};"></div>
                                    <div class="avatar-item" style="background-color: #${Math.floor(Math.random()*16777215).toString(16)};"></div>
                                </div>
                                <span class="participant-count">${Math.floor(Math.random() * 30) + 5}人参与</span>
                            </div>
                        </div>
                    </div>
                `;
                
                activities.push(activityCard);
            }
            
            return activities;
        }

        // 获取随机时间
        function getRandomTime() {
            const hours = Math.floor(Math.random() * 12) + 9;
            const minutes = Math.floor(Math.random() * 60);
            return `周${['日', '一', '二', '三', '四', '五', '六'][Math.floor(Math.random() * 7)]} ${hours}:${minutes.toString().padStart(2, '0')}`;
        }

        // 获取随机温度标签
        function getRandomTemperature() {
            const temperatures = ['hot', 'warm', 'calm'];
            return temperatures[Math.floor(Math.random() * temperatures.length)];
        }

        // 获取随机标签
        function getRandomTag() {
            const tags = ['sport', 'learning', 'social', 'food', 'culture', 'outdoor'];
            return tags[Math.floor(Math.random() * tags.length)];
        }

        // 处理导航切换
        function handleNavigation(page) {
            switch(page) {
                case 'home':
                    alert('跳转到首页');
                    break;
                case 'search':
                    // 搜索页面无需特殊处理
                    break;
                case 'publish':
                    alert('跳转到发布页面');
                    break;
                case 'profile':
                    alert('跳转到个人中心');
                    break;
            }
        }

        // 显示加载状态
        function showLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'block';
        }

        // 隐藏加载状态
        function hideLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'none';
        }

        // 模拟加载效果
        function simulateLoading() {
            showLoading();
            setTimeout(() => {
                hideLoading();
            }, 1500);
        }

        // 显示成功提示
        function showSuccessToast(message) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.style.display = 'block';
            
            // 3秒后自动隐藏
            setTimeout(() => {
                toast.style.display = 'none';
            }, 3000);
        }

        // 添加触摸反馈效果
        const buttons = document.querySelectorAll('button');
        buttons.forEach(button => {
            button.addEventListener('touchstart', function() {
                this.style.transform = 'scale(0.95)';
            });
            
            button.addEventListener('touchend', function() {
                this.style.transform = 'scale(1)';
            });
        });

        // 添加页面滚动效果
        let lastScrollTop = 0;
        window.addEventListener('scroll', function() {
            const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
            
            // 隐藏/显示底部导航
            const bottomNav = document.querySelector('.bottom-nav');
            if (scrollTop > lastScrollTop && scrollTop > 100) {
                bottomNav.style.transform = 'translateY(100%)';
            } else {
                bottomNav.style.transform = 'translateY(0)';
            }
            
            lastScrollTop = scrollTop;
        });

        // 添加返回顶部功能
        window.addEventListener('scroll', function() {
            if (window.pageYOffset > 300) {
                // 可以添加返回顶部按钮
            }
        });
    </script>
</body>
</html>
